﻿package com.coo.core 
{
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.system.System;

	public class AppManager extends Sprite
	{
		private var _align: String;
		private var _encode: String;
		
		private const ALIGN_ERROR: String = "AppManager  -  stage align is not already";
		private const OVERRIDE_ERROR: String = "AppManager  -  manager did not override any function";
		
		public function AppManager( align: String, encode: String = "utf-8" ) 
		{ 
			_align = align;
			_encode = encode;
			initialize();
		}
		
		public function initialize(): void
		{
			if ( _align == null || _align == "" ) throw new Error( ALIGN_ERROR );
			
			setStage();
			setting();
		}
		
		public function setStage(): void
		{
			stage.align 								= _align;
			stage.scaleMode 						= StageScaleMode.NO_SCALE;
			stage.showDefaultContextMenu  = false;
			
			System.useCodePage = ( _encode == "euc-kr" )? true : false;
		}
		
		public function setting(): void { throw new Error( OVERRIDE_ERROR );  }
	}
}